package com.eshin.amqpconfig;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;

@Configuration 
public class AmqpConfig { 
	   
//	    @Bean("foo")
//	    public Queue fooQueue(){
//	       return new  Queue("foo");
//	    }
//	    @Bean("foo123")
//	    public Queue fooQueue123(){
//	    	return new  Queue("foo123");
//	    }
//	    
//	    @Bean
//	    TopicExchange exchange() {
//	        return new TopicExchange("fooex");
//	    }
//
//	    @Bean
//	    Binding bindingExchangeMessages(@Qualifier("foo")Queue queueMessages, TopicExchange exchange) {
//	        return BindingBuilder.bind(queueMessages).to(exchange).with("topic.111");
//	    }
//	    @Bean
//	    Binding bindingExchangeMessages123(@Qualifier("foo123")Queue queueMessages, TopicExchange exchange) {
//	    	return BindingBuilder.bind(queueMessages).to(exchange).with("topic.123");
//	    }
	    @Bean  
	    public BeanPostProcessor postProcessor() {  
	        return new ScheduledAnnotationBeanPostProcessor();  
	    }
//	    @RabbitHandler
//	    @RabbitListener(queues="foo")
//	    public void onMessage(@Payload String foo){
//	       System.out.println(" >>> "+new Date() + ": " + foo);
//	    }
}
